<template>
  <div>
    <el-row>
      <el-col>
        <div id="brokenLine" :style="{width: '100%', height: '400px'}"></div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        msg: ''
      }
    },
    mounted() {
      this.drawLine();
    },
    methods: {
      drawLine() {
        // 基于准备好的dom，初始化echarts实例
        let brokenLine = this.$echarts.init(document.getElementById('brokenLine'));
        // 绘制图表
        brokenLine.setOption(
/*          {
            title: {
              text: '折线图堆叠'
            },
            tooltip: {
              trigger: 'axis'
            },
            legend: {
              data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
            },
            grid: {
              left: '3%',
              right: '4%',
              bottom: '3%',
              containLabel: true
            },
            toolbox: {
              feature: {
                saveAsImage: {}
              }
            },
            xAxis: {
              type: 'category',
              boundaryGap: false,
              data: ['周一','周二','周三','周四','周五','周六','周日']
            },
            yAxis: {
              type: 'value'
            },
            series: [
              {
                name:'邮件营销',
                type:'line',
                stack: '总量',
                data:[120, 132, 101, 134, 90, 230, 210]
              },
              {
                name:'联盟广告',
                type:'line',
                stack: '总量',
                data:[220, 182, 191, 234, 290, 330, 310]
              },
            ]
          }*/
          {
            tooltip: {
              trigger: 'item'
            },
            textStyle:{
              color:'#fff',
            },
            xAxis: {
              type: 'category',
              data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
            },
            yAxis: {
              type: 'value',
              axisLabel: {
                formatter: '{value} %'
              },
            },
            series: [
              {
              data: [82, 148, 90, 93, -86, 98, -50, 23, 84, 69, -138, 88],
              type: 'line',
              smooth: true,
              itemStyle: {
                normal: {
                  color: "#a6c733"
                },
              },
            },
              {
                data: [148, 82, 93, 90, -98, 86, -23, 50, 69, 84, -88, 138],
                type: 'line',
                smooth: true,
                itemStyle: {
                  normal: {
                    color: "#a6c733"
                  },
                },
              },
            ]
          }
        );
      }
    }
  }
</script>

<style scoped>

</style>
